/**
 * Project Name:mauto-web
 * File Name:BpRule.java
 * Package Name:com.inftech.mauto.common.base
 * Date:2016年12月24日下午4:05:01
 * Copyright (c) 2016, inf-technology Co., Ltd. All Rights Reserved.
 *
*/

package com.inftech.mauto.common.base;

import java.math.BigDecimal;
import java.util.List;

import org.easyrules.annotation.Action;
import org.easyrules.annotation.Condition;
import org.easyrules.annotation.Rule;

import com.inftech.mauto.sys.entity.Goods;

/**
 * ClassName:BpPriceRule <br/>
 * Function: 钣喷价格规则. <br/>
 * Date: 2016年12月24日 下午4:05:01 <br/>
 * 
 * @author puyf
 * @version
 * @since JDK 1.7
 */
@Rule(name = "banpen price rule", description = "banpen price rule")
public class BpPriceRule {

	/**
	 * 商品列表
	 */
	private List<Goods> goodsList;

	/**
	 * 商品总额
	 */
	private BigDecimal goodsAmount = new BigDecimal("0.00");
	
	@Condition
	public boolean when() {
		if (goodsList == null || goodsList.size() == 0) {
			return false;
		} else {
			return true;
		}
	}
	
	/**
	 * 
	 * calc:简单价格合计. <br/>
	 *
	 * @author puyf
	 * @throws Exception
	 * @since JDK 1.7
	 */
	@Action(order = 1)
    public void calc() throws Exception {
        for(Goods goods:goodsList){
        	goodsAmount.add(goods.getGoodsPrice());
        }
    }


	public List<Goods> getGoodsList() {
		return goodsList;
	}

	public void setGoodsList(List<Goods> goodsList) {
		this.goodsList = goodsList;
	}

	public BigDecimal getGoodsAmount() {
		return goodsAmount;
	}

	public void setGoodsAmount(BigDecimal goodsAmount) {
		this.goodsAmount = goodsAmount;
	}

	

}
